﻿using DevExpress.XtraEditors;
using SX_MesProject.Dtos;
using SX_MesProject.Dtos.WarehouseDTO;
using SX_MesProject.ProcessManage;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace SX_MesProject.Warehouse
{
    public partial class WarehouseManagement : DevExpress.XtraEditors.XtraForm
    {
        public WarehouseManagement()
        {
            InitializeComponent();
        }

        private void simpleButton2_Click(object sender, EventArgs e)
        {

        }

        private void gridControl1_Load(object sender, EventArgs e)
        {
            WarehouseLists();
        }
        private async Task WarehouseLists()
        {
            try
            {
                var list = await HttpClientHelper.RequestUrl<string, ResponseDto<List<WarehouseList>>>("https://localhost:44556/", "GetWarehouses", HttpClientHelper.MethodType.GET);
                this.gridControl1.DataSource = list.Data;


            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }


        }

        private void WarehouseManagement_Load(object sender, EventArgs e)
        {

        }

        private void simpleButton1_Click(object sender, EventArgs e)
        {
            WarehouseInfor warehouseInfor = new WarehouseInfor();
            warehouseInfor.OnLoadData += WarehouseLists;
            warehouseInfor.ShowDialog();

        }

        private void panelControl1_Paint(object sender, PaintEventArgs e)
        {

        }

        private void gridControl1_Click(object sender, EventArgs e)
        {

        }
    }
}